-- equip_to_attrib
-- created by zhuangsl
-- 每穿着一件装备提升属性

return {
    apply = function(prop, baseValue)
        return prop[3];
    end,

    trigger = function(who, prop, value)
        if who.type ~= OBJECT_TYPE_USER then
            return value;
        end
        
        local num = prop[3];
        local equipments = ME.user.equipments;

        -- 没有装备
        if not equipments or #table.keys(equipments) <= 0 then
            return value;
        end

        -- 遍历每个部位
        for _, equiped in pairs(equipments) do
            if #equiped > 0 then
                value = value + num;
            end
        end
         
        return value;
    end,

    record = function(target, prop, path)
        return false;
    end 
};